/*
 * Copyright (c) 2011-2023, ThinkWide (cnet2001@163.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.thinkwide.data.config;

import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * 数据配置
 *
 * @author andyzhang
 * @since 2023/06/10
 */
@Data
public class GlobalConfig {

    private static Logger logger = LoggerFactory.getLogger(GlobalConfig.class);

    private boolean banner = true;

    public static boolean AUTOCASE = true;

    public static boolean SHOWSQL = true;

    public static void show_sql(String sql, List paramList) {
        if (SHOWSQL) {
            logger.info("##sql:{}", sql);
            logger.info("##参数:{}", paramList.toString() );
        }
    }

    public static void show_sql(String sql) {
        if (SHOWSQL) {
            logger.info("##sql:{}", sql);
        }
    }

    @Data
    public static class DbConfig {

        /**
         * 表名前缀
         */
        private String tablePrefix;

        /**
         * 表名是否使用驼峰转下划线命名,只对表名生效
         */
        private boolean tableUnderline = true;
        /**
         * 大写命名,对表名和字段名均生效
         */
        private boolean capitalMode = false;

        /**
         * 逻辑删除全局属性名
         */
        private String logicDeleteField;
        /**
         * 逻辑删除全局值（默认 1、表示已删除）
         */
        private String logicDeleteValue = "1";
        /**
         * 逻辑未删除全局值（默认 0、表示未删除）
         */
        private String logicNotDeleteValue = "0";

    }
}
